<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core" %>

<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<html>
<head>
	<title>欢迎使用题库系统</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<!--CSS import-->
	<link rel="stylesheet" type="text/css" href="${ctx}/resources/extjs/resources/css/ext-all.css">
	<link rel="stylesheet" type="text/css" href="${ctx}/resources/css/admin/system.css">
	<link rel="shortcut icon" type="image/x-icon" href="${ctx}/resources/image/icon/index/tr.ico" />
	<!--Ext import-->
	<script type="text/javascript" src="${ctx}/resources/extjs/adapter/ext/ext-base.js"></script>
	<script type="text/javascript" src="${ctx}/resources/extjs/ext-all.js"></script>
	<script type="text/javascript" src="${ctx}/resources/extjs/ext-lang-zh_CN.js"></script>
	<script type="text/javascript" src="${ctx}/resources/extjs/ux/notify/Ext.ux.Notification.js"></script>
	<script type="text/javascript" src="${ctx}/resources/js/common/ExtFunc.js"></script>

	<script type="text/javascript">
		Ext.onReady(function(){
			var form = new Ext.form.FormPanel({
				url : "login",
				frame : true,
				bodyStyle : 'padding:20 0 0 0;',
				defaults : {
					anchor : "94%"
				},
				labelAlign : "right",
				labelWidth : 60,
				items : [
					{
					xtype : "textfield",
					fieldLabel : "用户名",
					cls : "username",
					style : 'padding-left:18px',
					name : "username",
					allowBlank : false
				}, {
					xtype : "textfield",
					inputType : "password",
					fieldLabel : "密&nbsp;&nbsp;&nbsp码",
					cls : "password",
					style : 'padding-left:18px',
					name : "pwd",
					allowBlank : false
				}]
			});
			var win =  new Ext.Window({
				title : "系统登录",
				layout : "fit",
				plain: true,
				bodyStyle : 'padding:5px;',
				closable : false,
				width : 300,
				height : 200,
				items : [form],
				buttonAlign : "center",
				buttons : [{
					text : "登录",
					iconCls : "login",
					handler : function(){
						if(!form.getForm().isValid()){
							showFailMsg("请输入用户名和密码");
							return false;
						}
						var waiting = Ext.Msg.wait('登录中，请稍后...', '', '');
						form.getForm().submit({
							success : function(form, action){
								window.location.href = "admin";
							},
							failure : function(form, action){
								if (waiting != null) {
									waiting.hide();
								}
								var msg = action.result.msg;
								showFailMsg(msg);
							}
						});
					}
				}, {
					text : "重置",
					iconCls : "reset",
					handler: function(){
						form.getForm().reset();
					}
				}]
			});
			win.show();
		});
	</script>
</head>
</html>